package fyp.spedmew.backend.entity;

import com.google.api.server.spi.config.AnnotationBoolean;
import com.google.api.server.spi.config.ApiResourceProperty;
import com.googlecode.objectify.Key;
import com.googlecode.objectify.Ref;
import com.googlecode.objectify.annotation.Entity;
import com.googlecode.objectify.annotation.Id;
import com.googlecode.objectify.annotation.Index;
import com.googlecode.objectify.annotation.Load;
import com.googlecode.objectify.annotation.Parent;

import java.util.Date;

import fyp.spedmew.backend.category.JobStatus;


@Entity
public class Job {

    public Job() {
    }

    @Id
    private Long id;

    private String title;

    private String detail;

    @ApiResourceProperty(ignored = AnnotationBoolean.TRUE)
    @Index
    private Key<User> sender;

    @ApiResourceProperty(ignored = AnnotationBoolean.TRUE)
    @Index
    private Key<User> dispatcher;

    @ApiResourceProperty(ignored = AnnotationBoolean.TRUE)
    @Index
    private Key<User> recipient;

    private Date shipDate;

    private Date pickupDateTime;

    private Date deliverDateTime;

    private Address pickupAddress;

    private Address deliverAddress;

    @Index
    private Date createdDate;

    private String instruction;

    private String price;

    private String imgKey;

    @Index
    private String status;

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public String getTitle() {
        return title;
    }

    public void setTitle(String title) {
        this.title = title;
    }


    public Key<User> getSender() {
        return sender;
    }

    public void setSender(Key<User> sender) {
        this.sender = sender;
    }

    public Long getSenderId() {
        return sender == null ? null : sender.getId();
    }

    public void setSenderId(Long senderId) {
        sender = Key.create(User.class, senderId);
    }

    public Key<User> getDispatcher() {
        return dispatcher;
    }

    public void setDispatcher(Key<User> dispatcher) {
        this.dispatcher = dispatcher;
    }

    public Long getDispatcherId() {
        return dispatcher == null ? null : dispatcher.getId();
    }

    public void setDispatcherId(Long dispatcherId) {
        dispatcher = Key.create(User.class, dispatcherId);
    }

    public Key<User> getRecipient() {
        return recipient;
    }

    public void setRecipient(Key<User> recipient) {
        this.recipient = recipient;
    }

    public Long getRecipientId() {
        return recipient == null ? null : recipient.getId();
    }

    public void setRecipientId(Long recipientId) {
        recipient = Key.create(User.class, recipientId);
    }

    public String getDetail() {
        return detail;
    }

    public void setDetail(String detail) {
        this.detail = detail;
    }

    public Date getShipDate() {
        return shipDate;
    }

    public void setShipDate(Date shipDate) {
        this.shipDate = shipDate;
    }

    public Date getPickupDateTime() {
        return pickupDateTime;
    }

    public void setPickupDateTime(Date pickupDateTime) {
        this.pickupDateTime = pickupDateTime;
    }

    public Date getDeliverDateTime() {
        return deliverDateTime;
    }

    public void setDeliverDateTime(Date deliverDateTime) {
        this.deliverDateTime = deliverDateTime;
    }

    public Address getPickupAddress() {
        return pickupAddress;
    }

    public void setPickupAddress(Address pickupAddress) {
        this.pickupAddress = pickupAddress;
    }

    public Address getDeliverAddress() {
        return deliverAddress;
    }

    public void setDeliverAddress(Address deliverAddress) {
        this.deliverAddress = deliverAddress;
    }

    public Date getCreatedDate() {
        return createdDate;
    }

    public void setCreatedDate(Date createdDate) {
        this.createdDate = createdDate;
    }

    public String getInstruction() {
        return instruction;
    }

    public void setInstruction(String instruction) {
        this.instruction = instruction;
    }

    public String getPrice() {
        return price;
    }

    public void setPrice(String price) {
        this.price = price;
    }

    public String getStatus() {
        return status;
    }

    public void setStatus(String status) {
        this.status = status;
    }

    public String getImgKey() {
        return imgKey;
    }

    public void setImgKey(String imgKey) {
        this.imgKey = imgKey;
    }
}
